package cate.common.table.d;


import cate.common.table.common.ParamSheet;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass("未归类的全局定义")
public class GD {

    @NoteField("尚未在全局变量excel中定义的ID")
    public static final int UNDEFINED = 99999110;

    @NoteField("double 0.0")
    public static final double DOUBLE_0 = 0.0;

    @NoteField("int 0")
    public static final int INT_0 = 0;

    @NoteField("濒死条件")
    public static final double NEAR_DEATH = 2.0;


    @NoteField("百")
    public static final double H_100_0 = 100.0;

    @NoteField("万")
    public static final double W_10000_0 = 10000.0;

    @NoteField("万")
    public static final int W_10000 = 10000;

    @NoteField("正数")
    public static final int POSITIVE = 1;

    @NoteField("负数")
    public static final int NEGATIVE = -1;

    @NoteField("非法消耗配置")
    public static final String ILLEGAL_COST_CFG = "3:-1:999999999";

    @NoteField("是否处于单元测试状态")
    public static boolean UNIT_TEST_MODE = false;

    @NoteField("全局变量中的id=0的那一项")
    public static String FIRST;

    @NoteClass("性别")
    public static class Gender {

        @NoteField("女性")
        public static final byte FEMALE = 0;

        @NoteField("男性")
        public static final byte MALE = 1;

        @NoteField("第三性别")
        public static final byte X = 2;

        public static String description(byte g) {
            switch (g) {
                case FEMALE:
                    return "女";
                case MALE:
                    return "男";
                case X:
                    return "X";
                default:
                    return "unsupported";
            }
        }
    }

    @NoteClass("比较操作")
    public static class Compare {
        @NoteField("无操作")
        public static final byte NULL = -1;

        @NoteField("等于 =")
        public static final byte EQ = 0;

        @NoteField("小于 <")
        public static final byte LT = 1;

        @NoteField("小于等于 <=")
        public static final byte LTE = 2;

        @NoteField("大于 >")
        public static final byte GT = 3;

        @NoteField("大于等于 >=")
        public static final byte GTE = 4;

        public static String description(byte c) {
            switch (c) {
                case NULL:
                    return "无操作";
                case EQ:
                    return "=";
                case LT:
                    return "<";
                case LTE:
                    return "<=";
                case GT:
                    return ">";
                case GTE:
                    return ">=";
                default:
                    return "unsupported";
            }
        }

        public static boolean calc(byte c, double v1, double v2) {
            switch (c) {
                case EQ:
                    return v1 == v2;
                case LT:
                    return v1 < v2;
                case LTE:
                    return v1 <= v2;
                case GT:
                    return v1 > v2;
                case GTE:
                    return v1 >= v2;
                default:
                    return true;
            }
        }
    }


    /**
     * 读取excel中配置的参数
     */
    public static void initialize(ParamSheet paramSheet) {
        GDFriend.initialize(paramSheet);
        GDBag.initialize(paramSheet);
        GDProp.initialize(paramSheet);
        GDRune.initialize(paramSheet);
        GDTower.initialize(paramSheet);
        GDGuild.initialize(paramSheet);
        GDPrivilege.initailize(paramSheet);
        GDHero.initialize(paramSheet);
        GDEquip.initialize(paramSheet);
        GDChat.initialize(paramSheet);
        GDSpice.initialize(paramSheet);
        GDSpiceFb.initialize(paramSheet);
        GDSpiceCall.initialize(paramSheet);
        GDRank.initialize(paramSheet);
        GDDailyFb.initialize(paramSheet);
        GDEliteRace.initialize(paramSheet);
        GDPart.initialize(paramSheet);
        GDPointRace.initialize(paramSheet);
        GDCamp.initialize(paramSheet);
        GDBlog.initialize(paramSheet);
        GDHeroCall.initialize(paramSheet);
        GDHCUpCall.initialize(paramSheet);
        GDRestrictCall.initialize(paramSheet);
        GDHistory.initialize(paramSheet);
        GDAdventure.initialize(paramSheet);
        GDHallows.initialize(paramSheet);
        GDVideoHall.initialize(paramSheet);
        GDDailyGift.initialize(paramSheet);
        GDPlay.initialize(paramSheet);
        GDIsland.initialize(paramSheet);
        GDHeroTalent.initialize(paramSheet);
        GDAstrlogys.initialize(paramSheet);
        GDLadder.initialize(paramSheet);
        GDWarOrder.initialize(paramSheet);
        GDPosition.initialize(paramSheet);
        GDGem.initialize(paramSheet);
        GDGuildWar.initialize(paramSheet);
        GDCrossBoss.initialize(paramSheet);
        GDInscription.initialize(paramSheet);
        GDFriendAid.initialize(paramSheet);
        GDFairyGift.initialize(paramSheet);
        GDFurniture.initialize(paramSheet);
        GDEndless.initialize(paramSheet);
        GDMall.initialize(paramSheet);
        GDUdgPalace.initialize(paramSheet);
        GDFarm.initialize(paramSheet);
        GDCrystallDraw.initialize(paramSheet);
        GDFormations.initialize(paramSheet);
        GDAchievement.initialize(paramSheet);
        GDUpPool.initialize(paramSheet);
        GDChampionRace.initialize(paramSheet);
        GDGodTree.initialize(paramSheet);
        GDGradePvp.initialize(paramSheet);
        GDThrone.initialize(paramSheet);
        GDTeamPvp.initialize(paramSheet);
        GDCrossRank.initialize(paramSheet);
        FIRST = GDParamTool.getString(paramSheet, 0, "空");
    }
}
